package com.smart.community.property.controller;

import com.smart.community.commons.result.Result;
import com.smart.community.property.service.IPropertyService;
import com.smart.community.property.vo.RepairmanVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 维修人员管理控制器
 * @author Wu.Liang
 * @since 2025-01-30
 * @version 1.0.0
 */
@Slf4j
@RestController
@RequestMapping("/property/repairmen")
@Tag(name = "维修人员管理", description = "维修人员的查询、分配等接口")
public class RepairmanController {

    @Autowired
    private IPropertyService propertyService;

    @GetMapping
    @Operation(summary = "获取维修人员列表", description = "根据数据权限获取可用的维修人员列表")
    public Result<List<RepairmanVO>> getRepairmanList(
            @Parameter(description = "社区ID") @RequestParam(required = false) Long communityId,
            @Parameter(description = "状态：1-可用，0-不可用") @RequestParam(required = false) Integer status) throws Exception {
        log.info("获取维修人员列表，社区ID: {}, 状态: {}", communityId, status);
        List<RepairmanVO> repairmanList = propertyService.getRepairmanList(communityId, status);
        return Result.success(repairmanList);
    }
} 